BEGIN;

DROP FUNCTION IF EXISTS getPartnerById(integer);
DROP FUNCTION IF EXISTS getTheatreHallById(integer);
DROP FUNCTION IF EXISTS hashExpired(varchar);
DROP FUNCTION IF EXISTS getAllSeats(integer, integer, integer, integer, timestamp, timestamp, integer);
DROP FUNCTION IF EXISTS getSchedule(integer, timestamp, timestamp);
DROP FUNCTION IF EXISTS confirmBooking(varchar, integer, integer, integer);
DROP FUNCTION IF EXISTS addUnconfirmedBooking(integer, integer, integer, timestamp, integer, integer, varchar);
DROP FUNCTION IF EXISTS deleteUnconfirmedBooking(integer, integer, integer);
DROP FUNCTION IF EXISTS getBookings(integer, integer, integer, integer, integer);


-- booking_ticket
DROP TABLE IF EXISTS booking_ticket CASCADE;
DROP SEQUENCE IF EXISTS booking_ticket_id_seq;


-- booking
DROP TABLE IF EXISTS booking CASCADE;
DROP SEQUENCE IF EXISTS booking_id_seq;


-- theatre_hall_show
DROP TABLE IF EXISTS theatre_hall_show CASCADE;
DROP SEQUENCE IF EXISTS theatre_hall_show_id_seq;


-- show
DROP TABLE IF EXISTS show CASCADE;
DROP SEQUENCE IF EXISTS show_id_seq;


-- theatre_hall
DROP TABLE IF EXISTS theatre_hall CASCADE;
DROP SEQUENCE IF EXISTS theatre_hall_id_seq;


-- partner_theatre
DROP TABLE IF EXISTS partner_theatre CASCADE;
DROP SEQUENCE IF EXISTS partner_theatre_id_seq;


-- theatre
DROP TABLE IF EXISTS theatre CASCADE;
DROP SEQUENCE IF EXISTS theatre_id_seq;


-- partner
DROP TABLE IF EXISTS partner CASCADE;
DROP SEQUENCE IF EXISTS partner_id_seq;


-- api_hash
DROP TABLE IF EXISTS api_hash CASCADE;

COMMIT;
